﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Clipper.Model;

namespace Communication
{
    public class ReagentKitControl : ControlBase
    {
        string mS = "LS",//复位
           mL = "LL";//定位
           //mR="LR";

         /// <summary>
        /// 构造函数，设定命令
        /// </summary>
        /// <param name="N">复位</param>
        /// <param name="A">吸液</param>
        /// <param name="D">加液</param>
        /// <param name="R">清洗</param>
        public ReagentKitControl(short CanId,short subCanID)
        {
            mCanId = CanId;
            mSubCanId = subCanID;
            mSCmd = new Dictionary<int, string>();
            mSCmd.Add(0, mS);
            mSCmd.Add(1, mL);
            //mSCmd.Add(2, mR);
        }

        /// <summary>
        /// 复位
        /// </summary>
        public int Reset()
        {

            SendCmd(0,mS);
            mStatus = -100;
            return 0;
        }

        /// <summary>
        /// 左定位
        /// </summary>
        public int LeftPosition()
        {
            SendCmd(1,mL);
            mStatus = -1;
            return 1;
        }

        /// <summary>
        /// 定位
        /// </summary>
        ///<param name="holeIndex">要转到的孔位号</param>
        public int Position(int holeIndex)
        {  
            Can.SendCan(mSubCanId, 1 + "ED" + holeIndex + Can.strEnd);
            //Thread.Sleep(10);
            CmdModel _cmdModel= SendCmd(1,mL);
            mStatus = -1;
            return 1;
        }

        /// <summary>
        /// 右定位
        /// </summary>
        //public int RightPosition()
        //{
        //    SendCmd(mR);
        //    mStatus = -2;
        //    return 2;
        //}
    }
}
